package org.darkforest.common.services.impl;

import org.darkforest.dao.mapper.AlbumClassMapper;
import org.darkforest.dao.redis.AlbumClassRedisDao;
import org.darkforest.common.services.IAlbumClassService;
import org.darkforest.model.AlbumClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by valentina on 15/3/19.
 */
@Service
public class AlbumClassServiceImpl implements IAlbumClassService {

    @Autowired
    private AlbumClassRedisDao albumClassRedisDao;

    @Autowired
    private AlbumClassMapper albumClassMapper;

    @Override
    public void initAlbumClassList(Integer storeId) {
        List<AlbumClass> albumClsList = albumClassMapper.getAlbumbyStoreId(storeId);
        albumClassRedisDao.addAlbumClassList("album_cls_"+storeId,albumClsList);
    }

    @Override
    public void addAlbumClass(Integer storeId,AlbumClass cls) {

    }

    @Override
    public void deleteAlbumClass(Integer storeId,Integer clsId) {

    }

    @Override
    public List<AlbumClass> getAlbumClassList(Integer storeId) {
//        return albumClassRedisDao.getAlbumClassList("album_cls_"+storeId);
        return albumClassMapper.getAlbumbyStoreId(storeId);
    }

    @Override
    public String getAlbumNameByCls(Integer storeId,Integer albumClsId) {
        return null;
    }
}
